<template>
	<view style="display: flex;">
		<image :src="imageSrc" @click="lookImg" style="width: 200px; height: 200px"></image>
	</view>
</template>

<script>
	import cacheIamgeService from './cacheIamgeService.js';

	export default {
		data() {
			return {
				imageSrc: ''
			}
		},
		props: {
			src: {
				type: String,
				required: true
			},
			picId: {
				type: String,
				required: true
			}
		},
		mounted() {
			cacheIamgeService.getImageSrcByPicId(this.picId, this.src).then((data) => {
				this.imageSrc = data;
			}, () => {
				this.imageSrc = this.src;
			});
		},
		methods: {
			lookImg() {
				uni.previewImage({
					urls: [this.imageSrc],
					current: 0
				})
			}
		}
	}
</script>

<style scoped>

</style>
